package com.c78.fz.controller;

import com.c78.fz.common.result.Result;
import com.c78.fz.model.entity.WaterMan;
import com.c78.fz.service.WaterManService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/watermans")
public class WaterManController {
    @Resource
    WaterManService waterManService;

    @GetMapping("/getwaterman")
    public Result list(String name,Integer pageNum,Integer pageSize){
        return waterManService.getWaterManPage(name,pageNum,pageSize);
    }

    @PutMapping("/updbasicsalary")
    public Result updateBasicSalary(Integer basicSalary, Integer id) {
        return waterManService.updateBasicSalary(basicSalary,id);
    }

    @DeleteMapping("/delwaterMan/{id}")
    public Result deleteWaterMan(@PathVariable Integer id){
        return waterManService.deleteWaterMan(id);
    }

    @PostMapping("/addwaterman")
    public Result saveWaterMan(@RequestBody WaterMan waterMan) {
        return waterManService.saveWaterMan(waterMan);
    }

    @PutMapping("/updwaterman")
    public Result updateWaterMan(@RequestBody WaterMan waterMan) {
        return waterManService.updateWaterMan(waterMan);
    }

    @GetMapping("/getwatermanbyid/{id}")
    public Result getWaterManById(@PathVariable Integer id) {
        return waterManService.getWaterManById(id);
    }

    @GetMapping("/getwatermanlist")
    public Result getWaterManList() {
        return waterManService.getWaterMan();
    }

    @GetMapping("/getwatermansalary")
    public Result getWaterManSalary(String startTime, String endTime, Integer pageNum, Integer pageSize){
        return waterManService.getSalaryPage(startTime,endTime,pageNum,pageSize);
    }

    @GetMapping("/getwatermanno")
    public Result getWaterManNo(String startTime, String endTime, Integer pageNum, Integer pageSize){
        return waterManService.getWaterManNo(startTime,endTime,pageNum,pageSize);
    }


    @GetMapping("/getwatermancount")
    public Result getWaterCount(String name,Integer pageNum,Integer pageSize) {
        return waterManService.getWaterCount(name,pageNum,pageSize);
    }
}